:: It is recommended to test the script on a local machine for its purpose and effects. :: ManageEngine Desktop Central will not be responsible for any :: damage/loss to the data/setup based on the behavior of the script. :: Description - Script to check Service running status :: Script Argument - "" :: Remarks - Enable Logging option must be selected to view result :: Configuration Type - COMPUTER/USER :: =========================================================================================================================== @echo off set myvar=Service Not Found FOR /F "tokens=4" %%i in ('sc query %1 ^| find "STATE"') do set myVar=%%i echo %myvar%